<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        #home .main {
            width: 100px;
            height: 100px;
            /* margin-top: 20px; */
        }

        #home .main img {
            width: 100%;
        }

        #home {
            /* position: fixed; */
            position: absolute;
            width: 100%;
            bottom: 0;
        }

        .home-div {
            width: 100%;
            height: 100px;
            background-color: #999;
            border-top: 1px solid transparent;
           
            display: flex;

            bottom: 0;
        }

        #home .title:nth-child(2){
            padding-left: 120px;
        }

        .right {
            padding-left: 20px;
        }

        .right .value {
            margin-bottom: 45px;
        }

        .goods-num {
            width: 50px;
            height: 20px;
            background-color: blue;
            margin-left: 100px;
            margin-top: 30px;
        }
        .empty{
            width: 100%;
            height: 100px;
            line-height: 100px;
            text-align: center;
        }

        .summary{
            width: 100%;
            height: 30px;
            background-color: rgb(202, 198, 198);
        }
    </style>
</head>

<body>
    <div id="home">
        <div class="title">
            <span @click="sort()">已选商品</span>
            <span @click="clear" >清空</span>

        </div>
        <div v-if="Arr.length != 0 ">
            <div class="home-div" v-for="(item,index) in Arr">
                <div class="main"><img :src="item.image" alt="" class="main"></div>

                <div>
                    <h2 class="value">{{item.value}}</h2>
                    <p class="month">{{item.month}}</p>



                </div>

                <div class="goods-num">
                    <span @click="sub(item)">-</span>
                    <span>{{item.goodsnum}}</span>
                    <span @click="add(item)">+</span>
                </div>
                

            </div>
            
 <!-- <div v-show="Arr.length == 0" class="empty">购物车空空如也</div>-->
        </div>
        <div v-else class="empty">购物车空空如也</div>

        <div class="summary">
            <span>
               总数： {{totalCount}}
            </span>
            <span>总价：{{totalPrice}}</span>
        </div>

    </div>
</body>

</html>
<script src="vue-2.5.21.js"></script>
<script src="作业2.js"></script>